import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: '设备管理',
    meta:{
      name:'设备管理'
    },
    component:()=> import('../views/deviceManagement/device')
  },
  {
    path: '/dataMain',
    name: '数据中心',
    meta:{
      name:'数据中心'
    },
    component:()=> import('../views/dataMain/index')
    // children:{
    //   path:'/',
    //   name:'current',
    //   component:()=> import('../views/dataMain/charts/index')
    // }
  },
]

const router = new VueRouter({
  routes
})

router.beforeEach((to,from,next)=>{
  if (to.matched[0].meta.name) {
    document.title = to.matched[0].meta.name
  }
  next()
})

export default router
